<template>
    <div class="mui-numbox" data-numbox-min="1">
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input class="mui-input-numbox" type="number" @change="nowNum()" ref="num" :value="num" />
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>

<script type="text/ecmascript-6">
    import mui from "../../lib/mui/js/mui.min.js";

    export default {
        data(){
            return{
                num:1
            }
        },
        methods:{
            mounted(){
                mui(".mui-numbox").numbox()
                console.log(this.newValue)
            },
            nowNum(){

                this.num = this.$refs.num.value
                console.log("当前值"+ this.num)
                // mui(".mui-numbox").numbox().setOption('max',newValue)

                this.$emit('num',this.num)
            },
        },
        props:["max"],
        watch: {
            // 属性监听
            max: function (newVal, oldVal) {
                // 使用 JS API 设置 numbox 的最大值
                mui(".mui-numbox")
                    .numbox()
                    .setOption("max", newVal);
            }
        }
    };

</script>

<style lang="stylus" rel="stylesheet/stylus">

</style>